import request from './axiosInstance'

// 体检相关API
export const checkupApi = {
  // 创建体检记录
  createCheckup(data) {
    return request({
      url: '/checkups',
      method: 'post',
      data
    })
  },

  // 获取体检记录详情
  getCheckupDetail(id) {
    return request({
      url: `/checkups/${id}`,
      method: 'get'
    })
  },

  // 更新体检记录
  updateCheckup(id, data) {
    return request({
      url: `/checkups/${id}`,
      method: 'put',
      data
    })
  },

  // 删除体检记录
  deleteCheckup(id) {
    return request({
      url: `/checkups/${id}`,
      method: 'delete'
    })
  },

  // 获取体检记录列表
  getCheckupList(params) {
    return request({
      url: '/checkups',
      method: 'get',
      params
    })
  },

  // 获取体检统计信息
  getStatistics() {
    return request({
      url: '/checkups/stats',
      method: 'get'
    })
  },

  // 根据档案ID获取体检记录
  getCheckupByArchiveId(archiveId) {
    return request({
      url: `/checkups/archive/${archiveId}`,
      method: 'get'
    })
  },

  // 批量删除体检记录
  batchDeleteCheckups(ids) {
    return request({
      url: '/checkups/batch',
      method: 'delete',
      data: { ids }
    })
  }
}

export default checkupApi